package com.cnc.utils;

public class SearchUtil {
    private String opt_name;
    private String name;
    private int max;
    private int min;
    private String gender;

    public SearchUtil(String name,String Max,String Min,String gender){
        this.name=name;
        init_opt_name(name);
        init_Max(Max);
        init_Min(Min);
        init_gender(gender);
    }
    private void init_opt_name(String name){
        if(name==null||name.equals("")){
            opt_name="%";
        }else {
            opt_name="%"+name+"%";
        }
    }
    private void init_Max(String Max){
        if (Max==null||Max.equals("")){
            max=100;
        }else {
            max=Integer.parseInt(Max);
        }
    }
    private void init_Min(String Min){
        if (Min==null||Min.equals("")){
            min=0;
        }else {
            min=Integer.parseInt(Min);
        }
    }
    private void init_gender(String gender){
        if(gender==null||gender.equals("")){
            this.gender="%";
        }else {
            this.gender=gender;
        }
    }

    public String getOpt_name() {
        return opt_name;
    }

    public String getName() {
        return name;
    }

    public int getMax() {
        return max;
    }

    public int getMin() {
        return min;
    }

    public String getGender() {
        return gender;
    }

    @Override
    public String toString() {
        return "SearchUtil{" +
                "opt_name='" + opt_name + '\'' +
                ", name='" + name + '\'' +
                ", max=" + max +
                ", min=" + min +
                ", gender='" + gender + '\'' +
                '}';
    }

    public void setOpt_name(String opt_name) {
        this.opt_name = opt_name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setMax(int max) {
        this.max = max;
    }

    public void setMin(int min) {
        this.min = min;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }
}
